#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QNetworkReply>
#include <QNetworkAccessManager>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void httpResponse();

    void showPixmap(QByteArray buffer);
    void showPixmap(QPixmap pixmap);

private slots:
    void on_startAndStop_clicked();

    void on_saveImage_clicked();

    void on_pixelSelect_currentIndexChanged(int index);

private:
    Ui::MainWindow *ui;
    const std::string m_windowTitle = "天眼监控";
    QNetworkAccessManager m_httpManager;
    QNetworkRequest m_httpRequest;
    QNetworkReply *m_httpClient = nullptr;
    QByteArray frameBuffer;
    QNetworkAccessManager m_contrlManager;
    QNetworkRequest m_contrlRequest;
    QNetworkReply *m_contrlClient = nullptr;
    std::atomic_bool m_startAndStopFlag{false};
};
#endif // MAINWINDOW_H
